private ["_handled","_dikCode","_vel","_dir","_speed","_height","_lastkey"] ;
_handled = false ; 
//diag_log format["doKeyDown.sqf: %1",_this];
_dikCode = (_this select 1);
_lastkey = player getvariable ["jumpkey",0];

if ((_dikCode in actionKeys JUMP_ACTIONKEY) && { speed player > 8 } && {stance player == "STAND"} ) then {
	if  ((player == vehicle player) && { player getvariable ["jump",true] } && { isTouchingGround player } && { (JUMP_DoubleTapToJump == 0 ||  _lastkey >= time) }) then  {
		player setvariable ["jump",false,true];
		_vel = velocity player;
		_dir = direction player;
		_speed = JUMP_BASESPEED;
		_height = (6-((load player)*10)) max JUMP_MAXHEIGHT;
		player setVelocity [(_vel select 0)+(sin _dir*_speed),(_vel select 1)+(cos _dir*_speed),(_vel select 2)+_height];
		[[player,"AovrPercMrunSrasWrflDf"],"jump_fnc_playAnimation",nil,false] spawn BIS_fnc_MP; 
		player spawn {sleep 2;_this setvariable ["jump",true,true]};// disable jump for a time
	};
	player setvariable ["jumpkey",time + JUMP_DOUBLETAPDELAY];
	_handled=true;
} else {
	// If we move from any position to stand and weren't standing already, then we disable jump for 2 seconds.
	if ((_dikCode in actionKeys "Stand") && {stance player != "STAND"} ) then {
		player setvariable ["jump",false,true];
		player spawn {sleep 1;_this setvariable ["jump",true,true]};// disable jump for a time
	};
};
//diag_log format["doKeyDown.sqf: %1",_handled];
_handled;